package com.richper.springcloudh2020.service;

import com.richper.springcloudh2020.entities.CommonResult;
import com.richper.springcloudh2020.entities.Payment;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.concurrent.TimeUnit;

@Component
@FeignClient(value = "CLOUD-PAYMENT-SERVICE")
public interface OrderFeignService {

    @PostMapping(value = "/payment/insertPayMent")
    @ResponseBody
    CommonResult<Integer> insertPayMent(@RequestBody Payment payment);

    @GetMapping(value = "/payment/queryPayMentByID/{id}")
    @ResponseBody
    CommonResult<Payment> queryPayMentByID(@PathVariable("id") Long id);

    @GetMapping(value = "/payment/discovery")
    @ResponseBody
    Object discovery();

    @RequestMapping("/payment/lb/getPort")
    @ResponseBody
    String getPort();

    @RequestMapping("/payment/feignTimeOutDemo")
    public String feignTimeOutDemo();
}